import React from 'react'
import '@/assets/css/RoomInfo.scoped.css'

const Component = () => 
{
    let rid = React.params('rid')?? 0
    //房间信息
    let [room, SetRoom] = useState<object | any>({
        flag_text: [],
        price: 0,
    })

    React.useEffect(() => {
        RoomInfo()
    }, [])

    //房间信息
    const RoomInfo = async () => 
    {
        var result = await React.request.post('room/info', {
            rid: rid,
        })

        if(result.code == 0)
        {
            React.toast(result.msg, null, 'fail')
            return false
        }
        console.log(result)
        SetRoom(result.data.RoomInfo)
    }
    return (
        <>
            <div className="top"><div>立即预定</div></div>
            <div className="skeleton">
                {/* 房间信息 */}
                <div className="detail">
                    <div className="thumb">
                        <img src={room.thumb_text} alt="" />
                    </div>
                    <div className='right'>
                        <p>{room.name}</p>
                        <p>￥{room.price}</p>
                        <div className='tips'>
                            {room.flag_text && room.flag_text.map((flag:any, index:any) => <span key={index}> {flag} </span>)}
                        </div>
                    </div>
                </div>
            </div>
        </>
    )
}

export default Component